<!DOCTYPE html >
<html>
<head>
    <meta name="Generator" content="ECSHOP v2.7.3"/>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>支付订单</title>
    <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon"/>
    <meta name="Keywords" content=""/>
    <meta name="Description" content=""/>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="/template/default/css/public.css">
    <link rel="stylesheet" href="/template/default/css/ydui.css">

    <link rel="stylesheet" href="/template/default/css/flow.css">
    <style>
        .content_success li {
            height: auto;
        }
    </style>
<body style="background: rgb(235, 236, 237);">
<div class="tab_nav">
    <div class="header">
        <div class="h-left">
            <a class="sb-back" href="javascript:history.back(-1)" title="返回"><img
                    src="/template/default/images/arrow_left_white.png"/></a>
        </div>
        <div class="h-mid">提交订单</div>
    </div>
</div>

<div class="screen-wrap fullscreen login">

    <div class="content_success ">
        <div class="con-ct   fo-con">
            <h4 class="successtijiao">订单已经提交成功！</h4>
            <ul class="ct-list">
                <li>
                    订单号为：<em>${ordersPlateform.orderSn!}</em>
                </li>
                <!--<li>
                    您选定的配送方式为:<em>${ordersPlateform.deliveryTypeName}</em>
                </li>-->
                <li>
                    您选定的支付方式为:<em>${ordersPlateform.paymentConfigName}</em>
                </li>
                <li>
                    您的订单总金额为:<em class="price">￥${ordersPlateform.totalAmount}元</em>(含运费￥${ordersPlateform.deliveryFee}
                    <%if(ordersPlateform.paymentFee!=0.00){%>手续费￥${ordersPlateform.paymentFee}<%}%>)
                </li>
                <li>
                    您的订单应付款金额为:<em class="price">￥${ordersPlateform.unpaidAmount}元</em><%if(ordersPlateform.paidDeposit
                    > 0){%>(余额支付 ${ordersPlateform.paidDeposit})<%}%><%if(ordersPlateform.paidPointAsDeposit >
                    0){%>(积分抵扣 ${ordersPlateform.paidPointAsDeposit})<%}%>
                </li>
            </ul>

        </div>
        <%if (ordersPlateform.paymentConfig != null){%>
        <form action="/b/payment/gateway" method="post" style="margin-bottom: 40px">
            <input type="hidden" name="amountPayable" value="${amountPayable!}"/>
            <input type="hidden" name="paymentConfig.id" value="${ordersPlateform.paymentConfig.id!}"/>
            <input type="hidden" name="openId" value="${openId!}"/>
            <input type="hidden" name="paymentType" value="${ordersPlateform.paymentConfig.paymentConfigTypeValue}"/>
            <input type="hidden" name="shopId" value="${shopId!}"/>
            <input type="hidden" name="orderPlateFormId" value="${ordersPlateform.id!}">
            <div class="blank"></div>
            <br/>
            <table class="listTable">
                <tr>
                    <!--如果是微信支付,用post提交-->
                    <%if(ordersPlateform.paymentConfig.paymentConfigTypeValue=="weixin"){%>
                    <button type="button" id='' name="submit" value="yes" onclick="wxpay();"
                            style="width:100%;display: inline-block;padding: 0 33px;text-align: center;height: 35px;line-height: 35px;margin-right: 10px;color: #fff;background: #ff521d;font-size: 16px;border: none;border-radius: 5px;margin-top: 20px;">
                        立即支付
                    </button>
                    <p></p>
                    <%}else{%>
                    <button type="submit" id='submit' name="submit" value="yes"
                            style="width:100%;display: inline-block;padding: 0 33px;text-align: center;height: 35px;line-height: 35px;margin-right: 10px;color: #fff;background: #ff521d;font-size: 16px;border: none;border-radius: 5px; margin-top: 20px;">
                        立即支付
                    </button>
                    <p></p>
                    <%}%>
                </tr>
            </table>
        </form>
        <%}%>
        <div class=""style="margin-top: 40px;font-size: 13px;color:#a3afb7;padding: 0 20px">
            温馨提示：请收货后点击确认，确认之日起五个工作日内可以申请退换货，超过时间视为无异议。未点击确认的从发货之日起10日视为收货。
        </div>
    </div>


</div>

</body>


<!--微信支付-->
<script type="text/javascript" src="/res/plugins/weixin/static/weui/lib/jquery-2.1.4.js"></script>
<script type='text/javascript' src="/res/plugins/weixin/static/weui/js/jquery-weui.js"></script>
<script type="text/javascript" src="/template/default/js/ydui.js"></script>
<script type="text/javascript" src="/template/default/js/weixxin.js"></script>
<!-- layer -->
<script src="/res/plugins/weixin/static/layer/layer.js"></script>
<script type="text/javascript">
    /* 微信支付 */
    function wxpay() {
        //测试时修改为自己的openId 如果不修改会出现【下单账号与支付账号不一致】的提示 这里最好授权获取
        var openId = $("input[name='openId']").val();
        var total_fee = "${ordersPlateform.unpaidAmount}";//总费用
        var orderPlateFormId = $("input[name='orderPlateFormId']").val();
        var paymentConfigId = $("input[name='paymentConfig.id']").val();
        var paymentType = $("input[name='paymentType']").val();

        $.post("/b/payment/gateway",
            {
                "openId": openId,
                "total_fee": total_fee,
                "orderPlateFormId": orderPlateFormId,
                "shopId": '${shopId!}',
                "productId": '${productId!}',
                "paymentConfig.id": paymentConfigId,
                "paymentType": paymentType,
                "type": "wechatmini"
            },
            /*{"code":0,"data":"{\"timeStamp\":\"1515038201\",\"package\":\"prepay_id=wx2018010411564114e5dc17a00184006314\",\"paySign\":\"1EB4F7BC38C54B7286754C7E38B8A227\",\"appId\":\"wx8a609221cd68c2e3\",\"signType\":\"MD5\",\"nonceStr\":\"1515038201608\"}","message":null}*/
            function (res) {
                if (res.code == 0) {
                    var data = $.parseJSON(res.data);
                    window.wx.miniProgram.navigateTo({
                        url: '/pages/pay/pay?prePayId=' + data.prePayId + "&timeStamp=" + data.timeStamp + "&paySign=" + data.paySign + "&nonceStr=" + data.nonceStr
                    })


                } else {
                    if (res.code == 2) {
                        layer.alert(res.message);
                    } else {
                        layer.msg("参数错误：" + res.message, {shift: 6});
                    }
                }
            });
    }


</script>
</html>